# -*- encoding : utf-8 -*-
module Dynamic_invoke_module_method
  def invoke_module_method(module_name,method_name,args)
    if Object.const_defined?(module_name)
      required_module = Kernel.const_get(module_name)
      if required_module.respond_to?(method_name) then
        required_method = required_module.method(method_name)
        required_method.call(args)
      else
        puts "Invalid method '#{method_name}' for module '#{module_name}'"
        nil
      end 
    else
      puts "Invalid module '#{module_name}'"
      nil
    end
  end
end
